Class com.symantec.itools.vcafe.sort.QuickSort
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.vcafe.sort.QuickSort

Object
   |
   +----com.symantec.itools.vcafe.sort.QuickSort

public class QuickSort
extends Object
QuickSort.

Non-recursive implementation requires O(n*log(n)) comparisons for most data. That is, for 100 elements approx 650 comparisons instead of 10,000. Tested with reverse sorted, already sorted, random and constant data.

QuickSort.sort(SortableArray a);

A SortableArray must implement the SortableArray interface, i.e., define a getArray() method that returns an Object[] and a lessThan() method that compares two objects, e.g., a.lessThan(r,s) returns true iff r < s. You do not have to modify the arrays or the object classes in any way, you just have to know how to order the objects.

QuickSort cannot sort arrays of primitive types (unless they are encapsulated in objects).

Author:
RKF

Constructor Index

 o com.symantec.itools.vcafe.sort.QuickSort()

Method Index

 o sort(SortableArray)
Quicksort for SortableArray of Object.

Constructors

 o QuickSort
public QuickSort()

Methods

 o sort
public static void sort(SortableArray a)
Quicksort for SortableArray of Object.


All Packages  Class Hierarchy  This Package  Previous  Next  Index